import axios from "axios";

let CommonProvider = {
    //首页
    HomeInit: function(payload){
        let url = 'api/main/HomeInit';
        return axios.post(url, payload)
        .then(res=>res).catch();
    },
    
    //总排名
    Rank: function(payload){
        let url = 'api/main/Rank';
        return axios.post(url, payload)
        .then(res=>res).catch();
    },
    //发布
    Fabu:function(payload){
        let url = 'api/main/Fabu';
        return axios.post(url, payload)
        .then(res=>res).catch();
    },
    //我的发布
    myFabu:function(payload){
        let url = 'api/main/myFabu';
        return axios.post(url, payload)
        .then(res=>res).catch();
    },
     //删除我的发布
    DelmyFabu:function(payload){
        let url = 'api/main/DelmyFabu';
        return axios.post(url, payload)
        .then(res=>res).catch();
    },
    //发现
    Find:function(payload){
        let url = 'api/main/Find';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    //详情
    Msg:function(payload){
        let url = 'api/main/Msg';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    //图片上传
    uploadpic:function(payload){
        let url = 'api/main/uploadpic';
        return axios.post(url,payload,{
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        }).then(res=>res).catch();
    },
    //评论上传
    comment:function(payload){
        let url = 'api/comment/comment';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    //评论加载
    Com:function(payload){
        let url = 'api/main/Com';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    //删除评论
    DelCom:function(payload){
        let url = 'api/comment/DelCom';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    //收藏
    collect:function(payload){
        let url = 'api/collections/collect';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    //验证是否已收藏
    yan:function(payload){
        let url = 'api/collections/yan';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    //取消收藏
    Dcollect:function(payload){
        let url = 'api/collections/Dcollect';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    //我的收藏列表
    cList:function(payload){
        let url = 'api/collections/cList';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    Zan:function(payload){
        let url = 'api/main/Zan';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
    Search:function(payload){
        let url = 'api/main/Search';
        return axios.post(url,payload)
        .then(res=>res).catch();
    },
}

export default CommonProvider;